program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  A, B , I: Integer;

function Max (A, B : Integer) : Integer;
    begin
        if  (A > B) then
            Max := A
        else
            Max := B;
    end;

begin
  Readln(A, B);
  For I := 1 to Max(A, B) do
      if((( A mod I) = 0) and ((B mod I) = 0)) then
          write(I, ' ');
  Readln;
end.
